from sqlalchemy import Column, Integer, String, DateTime, Date, Text
from model import db


# 定义映射类User，其继承上一步创建的Base
class Test(db.Base):
    # 指定本类映射到users表
    __tablename__ = 'test'

    id = Column(Integer, primary_key=True, autoincrement=True)
    name = Column(String)
    created_time = Column(String,server_default="CURRENT_TIMESTAMP")
    updated_time = Column(String,server_default="CURRENT_TIMESTAMP")

    def to_json(self):
        dict = self.__dict__
        if "_sa_instance_state" in dict:
            del dict["_sa_instance_state"]
        return dict
